Skip to content

Conversation

@soburi
Copy link
Owner

@soburi soburi commented Nov 14, 2025

Summary

  • add event index tracking to virtqueues so used_event is maintained when the feature is negotiated
  • enable VIRTIO_RING_F_EVENT_IDX negotiation in the MMIO and PCI transports and propagate it to created queues

Testing

  • west build -b native_posix_64 samples/hello_world (fails: west not available in environment)

Codex Task

dsemenets and others added 14 commits October 13, 2025 23:57
Xen API contains hypercall, which allows domains to identify Xen
version, that is currently used on the system. It can be used to check
if current version is supported by Zephyr or to change behavior of the
drivers or services.

Signed-off-by: Dmytro Semenets <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
This hypercall can be used get some information about physical machine
and running guests:

- sysctl hypercall "xen_sysctl_getphysinfo" allows read information about
physical machine: number CPUs, memory sizes, hardware capabilities, etc.

- sysctl hypercall "xen_sysctl_getdomaininfolist" returns array of domain
info structures that provide information about particular domain(s).

Signed-off-by: Dmytro Semenets <[email protected]>
Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add the XEN_DOMCTL_getvcpuinfo domain control call to allow Domain-0 to
query information about a domain's virtual CPUs. This can be used by
management tools and services for gathering statistics and monitoring
the current status of vCPUs.

Signed-off-by: Dmytro Semenets <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
The size is passed in bytes, not in megabytes. So rename the parameter
to avoid confusion.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Document all of the public functions in the domctl API with doxygen

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
If 0 is passed as domain id to the Xen createdomain hypercall, it will
allocate a new domain id and return it via the domctl structure.
Allow callers to access this new domain id via a pointer arg.
This will allow to create domains without explicitly specifying the
domain id for them.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add a new Kconfig option CONFIG_XEN_DOMCTL_INTERFACE_VERSION that allows
to change the version of the Domctl interface used by Zephyr to issue
domctl hypercalls. Add compile-time checks to enable or disable certain
Domctl operations based on the selected Domctl interface version.
For now versions 0x15, 0x16, and 0x17 are supported.

Also it required to correctly guard domctl call that were not supported
prior to specified version.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add a new Kconfig option CONFIG_XEN_SYSCTL_INTERFACE_VERSION that allows
to change the version of the Sysctl interface used by Zephyr to issue
sysctl hypercalls.
For now versions 0x15 is supported.

Signed-off-by: Mykyta Poturai <[email protected]>
Signed-off-by: Dmytro Firsov <[email protected]>
Add wrappers for following XEN_DMOP_* hypercalls.
These enables Xen device model control path:
dm_op provides operations to create/manage the ioreq server
so guest MMIO accesses are trapped and handled by the hypervisor.
These are guarded by CONFIG_XEN_DMOP.

- dmop
  - dmop_create_ioreq_server
    XEN_DMOP_create_ioreq_server
  - dmop_map_io_range_to_ioreq_server
    XEN_DMOP_map_io_range_to_ioreq_server
  - dmop_set_ioreq_server_state
    XEN_DMOP_set_ioreq_server_state
  - dmop_nr_vcpus
    XEN_DMOP_nr_vcpus
  - dmop_set_irq_level:
    XEN_DMOP_set_irq_level

Signed-off-by: TOKITA Hiroshi <[email protected]>
Import `zephyr-xenlib` module.
That contains xen public headers.

Signed-off-by: TOKITA Hiroshi <[email protected]>
This introduces the vhost driver framework, providing standard APIs
for VIRTIO backend implementations in Zephyr. Includes vringh utility
for host-side VIRTIO ring processing based on Linux kernel
implementation.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Implements VirtIO backend over Xen MMIO interface

Signed-off-by: TOKITA Hiroshi <[email protected]>
Add sample application demonstrating vhost driver usage for
VIRTIO backend implementations. Includes basic setup and
configuration examples for Xen MMIO VirtIO backend.

Signed-off-by: TOKITA Hiroshi <[email protected]>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +60 to +64
vq->last_used_idx++;

if (cbe.cb) {
cbe.cb(cbe.opaque, used_len);
}
}
}
if (vq->event_idx_enabled) {
*vq->used_event = sys_cpu_to_le16(vq->last_used_idx);
barrier_dmem_fence_full();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include barrier header for new fence usage

The new event-idx handling in virtio_isr() writes to used_event and then calls barrier_dmem_fence_full() (lines 62‑64), but drivers/virtio/virtio_common.c still only includes logging, byteorder, and virtio headers (lines 7‑11). None of those headers declare barrier_dmem_fence_full(), so this translation unit now lacks a prototype for that function and fails to compile with implicit declaration of function ‘barrier_dmem_fence_full’ when built with the default C standard. Please add #include <zephyr/sys/barrier.h> to this file’s include list.

Useful? React with 👍 / 👎.

@soburi soburi force-pushed the xen-virtio-backend branch from 3641e2d to f83e864 Compare November 20, 2025 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants